package com.example.stock.controller;

import com.example.stock.entity.StockDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 唐佳辉
 * @CreateTime： 2025-05-07-15:27
 * @Description:
 * @Version：1.0
 */
@RestController()
@RequestMapping("/stock")
@Slf4j
public class StockController {

    @Value("${server.port}")
    private int port;

    @GetMapping("/getStock")
    public String stock() {

        // 获取当前服务的ip和端口

        return "" + port;
    }

    @GetMapping("/getStockDTO")
    public String getStockDTO(StockDTO stockDTO) {

        log.info("stockDTO:{}", stockDTO);
         //throw new RuntimeException();
        return stockDTO.toString();

    }
}
